//let domain = "http://localhost:9001/ap-center"; //域名
let domain = "http://1.117.138.87/ap-center" //域名
export const ajax_request = (_url, _data, _method) => {
  let org_url = _url;
  let org_data = _data;
  let org_method = _method;
  _url = domain + _url;
  _method = _method || "POST";
  _data = _data || {};
  let response_data = {
    head: {
      apSession: wx.getStorageSync("apSession"),
    },
    body: _data,
  };
  return new Promise((resolve, reject) => {
    wx.request({
      url: _url,
      data: response_data,
      method: _method,
      success: (result) => {
        resolve(result.data);
      },
      fail: (err) => {
        console.log("🚀 ~ file: request.js ~ line 25 ~ returnnewPromise ~ err", err)
        reject(err);
      },
    });
  });
};
